<?php


/*
* Copyright (c) 2008-2016 vip.com, All Rights Reserved.
*
* Powered by com.vip.osp.osp-idlc-2.5.11.
*
*/

namespace com\vip\vccp\service\vop\media;

class ProductDisplaySaveReq {
	
	static $_TSPEC;
	public $videoId = null;
	public $imageFileId = null;
	public $brandSn = null;
	public $sn = null;
	public $isProductListMaterial = null;
	public $title = null;
	public $hashtagSn = null;
	public $isRegular = null;
	public $regularStartTime = null;
	public $regularEndTime = null;
	public $tagIds = null;
	
	public function __construct($vals=null){
		
		if (!isset(self::$_TSPEC)){
			
			self::$_TSPEC = array(
			1 => array(
			'var' => 'videoId'
			),
			2 => array(
			'var' => 'imageFileId'
			),
			3 => array(
			'var' => 'brandSn'
			),
			4 => array(
			'var' => 'sn'
			),
			5 => array(
			'var' => 'isProductListMaterial'
			),
			6 => array(
			'var' => 'title'
			),
			7 => array(
			'var' => 'hashtagSn'
			),
			8 => array(
			'var' => 'isRegular'
			),
			9 => array(
			'var' => 'regularStartTime'
			),
			10 => array(
			'var' => 'regularEndTime'
			),
			11 => array(
			'var' => 'tagIds'
			),
			
			);
			
		}
		
		if (is_array($vals)){
			
			
			if (isset($vals['videoId'])){
				
				$this->videoId = $vals['videoId'];
			}
			
			
			if (isset($vals['imageFileId'])){
				
				$this->imageFileId = $vals['imageFileId'];
			}
			
			
			if (isset($vals['brandSn'])){
				
				$this->brandSn = $vals['brandSn'];
			}
			
			
			if (isset($vals['sn'])){
				
				$this->sn = $vals['sn'];
			}
			
			
			if (isset($vals['isProductListMaterial'])){
				
				$this->isProductListMaterial = $vals['isProductListMaterial'];
			}
			
			
			if (isset($vals['title'])){
				
				$this->title = $vals['title'];
			}
			
			
			if (isset($vals['hashtagSn'])){
				
				$this->hashtagSn = $vals['hashtagSn'];
			}
			
			
			if (isset($vals['isRegular'])){
				
				$this->isRegular = $vals['isRegular'];
			}
			
			
			if (isset($vals['regularStartTime'])){
				
				$this->regularStartTime = $vals['regularStartTime'];
			}
			
			
			if (isset($vals['regularEndTime'])){
				
				$this->regularEndTime = $vals['regularEndTime'];
			}
			
			
			if (isset($vals['tagIds'])){
				
				$this->tagIds = $vals['tagIds'];
			}
			
			
		}
		
	}
	
	
	public function getName(){
		
		return 'ProductDisplaySaveReq';
	}
	
	public function read($input){
		
		$input->readStructBegin();
		while(true){
			
			$schemeField = $input->readFieldBegin();
			if ($schemeField == null) break;
			$needSkip = true;
			
			
			if ("videoId" == $schemeField){
				
				$needSkip = false;
				$input->readString($this->videoId);
				
			}
			
			
			
			
			if ("imageFileId" == $schemeField){
				
				$needSkip = false;
				$input->readString($this->imageFileId);
				
			}
			
			
			
			
			if ("brandSn" == $schemeField){
				
				$needSkip = false;
				$input->readI32($this->brandSn); 
				
			}
			
			
			
			
			if ("sn" == $schemeField){
				
				$needSkip = false;
				$input->readString($this->sn);
				
			}
			
			
			
			
			if ("isProductListMaterial" == $schemeField){
				
				$needSkip = false;
				$input->readI32($this->isProductListMaterial); 
				
			}
			
			
			
			
			if ("title" == $schemeField){
				
				$needSkip = false;
				$input->readString($this->title);
				
			}
			
			
			
			
			if ("hashtagSn" == $schemeField){
				
				$needSkip = false;
				$input->readString($this->hashtagSn);
				
			}
			
			
			
			
			if ("isRegular" == $schemeField){
				
				$needSkip = false;
				$input->readI32($this->isRegular); 
				
			}
			
			
			
			
			if ("regularStartTime" == $schemeField){
				
				$needSkip = false;
				$input->readString($this->regularStartTime);
				
			}
			
			
			
			
			if ("regularEndTime" == $schemeField){
				
				$needSkip = false;
				$input->readString($this->regularEndTime);
				
			}
			
			
			
			
			if ("tagIds" == $schemeField){
				
				$needSkip = false;
				
				$this->tagIds = array();
				$_size0 = 0;
				$input->readListBegin();
				while(true){
					
					try{
						
						$elem0 = null;
						$input->readI64($elem0); 
						
						$this->tagIds[$_size0++] = $elem0;
					}
					catch(\Exception $e){
						
						break;
					}
				}
				
				$input->readListEnd();
				
			}
			
			
			
			if($needSkip){
				
				\Osp\Protocol\ProtocolUtil::skip($input);
			}
			
			$input->readFieldEnd();
		}
		
		$input->readStructEnd();
		
		
		
	}
	
	public function write($output){
		
		$xfer = 0;
		$xfer += $output->writeStructBegin();
		
		$xfer += $output->writeFieldBegin('videoId');
		$xfer += $output->writeString($this->videoId);
		
		$xfer += $output->writeFieldEnd();
		
		$xfer += $output->writeFieldBegin('imageFileId');
		$xfer += $output->writeString($this->imageFileId);
		
		$xfer += $output->writeFieldEnd();
		
		$xfer += $output->writeFieldBegin('brandSn');
		$xfer += $output->writeI32($this->brandSn);
		
		$xfer += $output->writeFieldEnd();
		
		$xfer += $output->writeFieldBegin('sn');
		$xfer += $output->writeString($this->sn);
		
		$xfer += $output->writeFieldEnd();
		
		$xfer += $output->writeFieldBegin('isProductListMaterial');
		$xfer += $output->writeI32($this->isProductListMaterial);
		
		$xfer += $output->writeFieldEnd();
		
		if($this->title !== null) {
			
			$xfer += $output->writeFieldBegin('title');
			$xfer += $output->writeString($this->title);
			
			$xfer += $output->writeFieldEnd();
		}
		
		
		if($this->hashtagSn !== null) {
			
			$xfer += $output->writeFieldBegin('hashtagSn');
			$xfer += $output->writeString($this->hashtagSn);
			
			$xfer += $output->writeFieldEnd();
		}
		
		
		if($this->isRegular !== null) {
			
			$xfer += $output->writeFieldBegin('isRegular');
			$xfer += $output->writeI32($this->isRegular);
			
			$xfer += $output->writeFieldEnd();
		}
		
		
		if($this->regularStartTime !== null) {
			
			$xfer += $output->writeFieldBegin('regularStartTime');
			$xfer += $output->writeString($this->regularStartTime);
			
			$xfer += $output->writeFieldEnd();
		}
		
		
		if($this->regularEndTime !== null) {
			
			$xfer += $output->writeFieldBegin('regularEndTime');
			$xfer += $output->writeString($this->regularEndTime);
			
			$xfer += $output->writeFieldEnd();
		}
		
		
		if($this->tagIds !== null) {
			
			$xfer += $output->writeFieldBegin('tagIds');
			
			if (!is_array($this->tagIds)){
				
				throw new \Osp\Exception\OspException('Bad type in structure.', \Osp\Exception\OspException::INVALID_DATA);
			}
			
			$output->writeListBegin();
			foreach ($this->tagIds as $iter0){
				
				$xfer += $output->writeI64($iter0);
				
			}
			
			$output->writeListEnd();
			
			$xfer += $output->writeFieldEnd();
		}
		
		
		$xfer += $output->writeFieldStop();
		$xfer += $output->writeStructEnd();
		return $xfer;
	}
	
}

?>